import { ImageFolderModel } from './image.folder.entity';
import { prop } from 'typegoose';
import { BaseModel } from '../base/BaseModel';

export class IImageInfo {
    name: string;
    src: string;
    size: number;
    width: number;
    height: number;
}

export class ImageStoreModel extends BaseModel {
    @prop({
        ref: ImageFolderModel,
    })
    folder: any;

    // 图片名称
    @prop() name: string;

    // 七牛地址
    @prop() src: string;

    @prop() size: number;

    @prop() width: number;

    @prop() height: number;
}

export const ImageStore = new ImageStoreModel().getModelForClass(
    ImageStoreModel,
    {
        schemaOptions: {
            timestamps: true,
            versionKey: false,
        },
    },
);
